#include <gtest/gtest.h>
#include <iostream>
#include "Data.h"
#include "DataHolderGarbageCollector.h"
#include "Memory.h"
#include "Variable.h"

TEST(DataHolderGarbageCollectorTest, Basics) {
	
	DHGC->deleteAll();
	
	Memory memory;
	
	Variable* var1 = Variable::createVariable("var1", Data::createInt(10));
	Variable::createVariable("var2", Data::createInt(20)); // Will leak!
	
	memory.addVariable(var1);
	
	EXPECT_EQ(Variable::getNrOfInstances(), 2);
	DHGC->collectGarbage();
	EXPECT_EQ(Variable::getNrOfInstances(), 1);
	DHGC->deleteAll();
}